package com.wandian.cqcsk.mvvm.mine.daka.dakasuccess;

import android.os.Bundle;
import android.view.View;

import androidx.databinding.DataBindingUtil;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mylib.libcore.AppContext;
import com.mylib.libcore.bean.UserInfoBean;
import com.mylib.libcore.config.CoinTypeEnum;
import com.mylib.libcore.config.RouterConfig;
import com.mylib.libcore.mvvm.BaseMVVMActivity;
import com.mylib.libcore.tools.CSJADTools;
import com.mylib.libcore.tools.GDTADTools;
import com.mylib.libcore.utils.ActivityUtil;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.cqcsk.R;
import com.wandian.cqcsk.databinding.ActivityDakaSuccessLayoutBinding;

import static com.mylib.libcore.config.AppConfig.CSJ_BANNER_ONE_ID;

/**
 * @author Administrator
 * @date 2019/12/18-14:28
 * @description EveryDayEnglishActivity
 **/
@Route(path = RouterConfig.ROUTER_ACTIVITY_DAKA_SUCCESS)
public class DaKaSuccessActivity extends BaseMVVMActivity<DaKaSuccessViewModel> {
    private ActivityDakaSuccessLayoutBinding dataBinding;

    @Override
    public void init(Bundle savedInstanceState) {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_daka_success_layout);
        dataBinding.setLifecycleOwner(this);
        dataBinding.setViewModel(mViewModel);
        UIUtils.setKeyEveryDayCoin(CoinTypeEnum.DK_COIN);
        initViewData();
        initClink();
       // CustomCoinToast.showToast(EveryDayDKActivity.this,"打卡奖励","1金币");
        //获取广告
        CSJADTools.loadCSJAdMiddleBanner(getContext(),dataBinding.rlAdBottom,"",CSJ_BANNER_ONE_ID,375,90);
        GDTADTools.loadHFAd(getContext(),dataBinding.flAdBottomGdt,375,0 );
    }

    private void initViewData(){
        ActivityUtil.getInstance().showStatusView(this,dataBinding.viewSysTop,true);
        dataBinding.bindTransparentToolBar.toolBarTvTitle.setText("打卡详情");
        dataBinding.bindTransparentToolBar.toolBarTitleRight.setText("打卡记录");
        dataBinding.bindTransparentToolBar.toolBarTitleRight.setVisibility(View.VISIBLE);
    }

    private void initClink(){
        dataBinding.bindTransparentToolBar.toolBarIvBack.setOnClickListener(v ->finish());
        dataBinding.bindTransparentToolBar.toolBarTitleRight.setOnClickListener(v ->{
            UserInfoBean userInfoBean = AppContext.getInstance().getAppPreferencesHelper().getUserInfoBean();
            Bundle bundle = new Bundle();
            bundle.putString("title","成长");
            bundle.putString("user_id",userInfoBean.getId()+"");
            bundle.putString("user_name",userInfoBean.getNickName());
            bundle.putString("user_head",userInfoBean.getHeadPic());
            bundle.putString("form_id",userInfoBean.getId()+"");
            bundle.putString("user_des",userInfoBean.getDescription()+"");
            ARouter.getInstance().build(RouterConfig.ROUTER_ACTIVITY_SETTING_USERHEADINFO).with(bundle).navigation();
        });
    }



}
